﻿using MediatR;
using T_Rbac.Read.APi.Application.Command.OperatetorCommand;
using T_Rbac_Demain;
using T_Rbac_Rep.Interface;

namespace T_Rbac.Read.APi.Application.Handlers.OperatorHandlers
{
    public class OperatorSearchByidHandlers : IRequestHandler<OperatorSearchByidCommand, Operator>
    {
        private readonly IOperator ioperator;

        public OperatorSearchByidHandlers(IOperator ioperator)
        {
            this.ioperator = ioperator;
        }

        public async Task<Operator> Handle(OperatorSearchByidCommand request, CancellationToken cancellationToken)
        {
            var list = await ioperator.GetAloneByid(request.id);
            return await Task.FromResult(list);
        }
    }
}
